var app = getApp()
Page({
  data: {
    userInfo: {},
    rate1:0,
    rate2:0,
    rate3:0,
    rate4:0,
    member_info:{},
    isrenzheng:false
  },
  onShareAppMessage: function (res) {
    let member_id = app.globalData.userInfo.member_id
    return {
      title: '成纪先锋微平台',
      path: '/pages/mine/mine?inviter_id=' + member_id,
      success: function (res) {
        // 转发成功
      },
      fail: function (res) {
        // 转发失败
      }
    }
  },
  onLoad: function (e) {
    var that = this;
    this.setData({ userInfo: app.globalData.userInfo })

  },
  onShow:function(e){
    let that = this
    app.check_logined({
      success:function(){
        that.setData({
          isrenzheng:true
        })
      },
      fail:function(){
        that.setData({
          isrenzheng: false
        })
        wx.showModal({
          title: '提示',
          content: '您需要进行实名认证',
          success: function (res) {
            if (res.confirm) {
              wx.navigateTo({
                url: '/pages/mine/login',
              })
            } else if (res.cancel) {
            }
          }
        })
      }
    })
    app.ajax("member_index", { rd_session: wx.getStorageSync('rd_session') }, (data, err) => {
      that.setData({
        member_info: data.data.member_info,
        rate1: data.data.rate1,
        rate2: data.data.rate2,
        rate3: data.data.rate3,
        rate4: data.data.rate4
      })
    })
  },
  tomeipian(){
    app.check_logined({
      success: function () {
        wx.navigateTo({
          url: '/pages/mine/article',
        })
      },
      fail: function () {
        wx.showModal({
          title: '提示',
          content: '您需要进行实名认证',
          success: function (res) {
            if (res.confirm) {
              wx.navigateTo({
                url: '/pages/mine/login',
              })
            } else if (res.cancel) {
            }
          }
        })
      }
    })
  },
  tostudy(){
    app.check_logined({
      success: function () {
        wx.navigateTo({
          url: '/pages/mine/minestudy',
        })
      },
      fail: function () {
        wx.showModal({
          title: '提示',
          content: '您需要进行实名认证',
          success: function (res) {
            if (res.confirm) {
              wx.navigateTo({
                url: '/pages/mine/login',
              })
            } else if (res.cancel) {
            }
          }
        })
      }
    })
  },
  tomeeting(){
    app.check_logined({
      success: function () {
        wx.navigateTo({
          url: '/pages/mine/hui',
        })
      },
      fail: function () {
        wx.showModal({
          title: '提示',
          content: '您需要进行实名认证',
          success: function (res) {
            if (res.confirm) {
              wx.navigateTo({
                url: '/pages/mine/login',
              })
            } else if (res.cancel) {
            }
          }
        })
      }
    })
  },
  toinfo(){
    app.check_logined({
      success: function () {
        wx.navigateTo({
          url: '/pages/mine/info',
        })
      },
      fail: function () {
        wx.showModal({
          title: '提示',
          content: '您需要进行实名认证',
          success: function (res) {
            if (res.confirm) {
              wx.navigateTo({
                url: '/pages/mine/login',
              })
            } else if (res.cancel) {
            }
          }
        })
      }
    })
  }
  
});